package cn.iocoder.yudao.module.shop.enums.store;

import cn.hutool.core.util.EnumUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * 会员积分的业务类型枚举
 *
 * @author 芋道源码
 */
@AllArgsConstructor
@Getter
public enum StoreBizTypeEnum {

    CREATE(1, "创建库存", "{}{}{}"),
    SHOPORDER_CHECK (2, "店铺消耗", "{} 消耗 {}{}{}"),
    TAKE (3, "领料", "{} 领取 {}{}{}"),
    IN(4, "入库","{} 入库{}{}{}"),

    SHOPORDER_ROLLBACK(5, "订单回退", "订单回退")
    ;
    /**
     * 类型
     */
    private final Integer type;
    /**
     * 名字
     */
    private final String name;
    /**
     * 描述
     */
    private final String description;

    public static StoreBizTypeEnum getByType(Integer type) {
        return EnumUtil.getBy(StoreBizTypeEnum.class,
                e -> Objects.equals(type, e.getType()));
    }
}
